#ifndef _WUTIL_LOG_H_
#define _WUTIL_LOG_H_

#include <string>
#include <time.h>
#include <list>

namespace UI
{


class UI_Log
{
public:
	struct SLogEntry
	{
		SLogEntry(time_t TimeStamp, unsigned int iSeverity, const std::string& sMessage) :
			m_TimeStamp(TimeStamp), m_iSeverity(iSeverity), m_sMessage(sMessage) { }
		SLogEntry(void) : m_TimeStamp(0), m_iSeverity(0) { }
		time_t m_TimeStamp;
		unsigned int m_iSeverity;
		std::string m_sMessage;
	};

	typedef std::list<SLogEntry> t_LogList;
	void AddLogEntry(const std::string& sMessage, unsigned int iSeverity, time_t TimeStamp)
		{ m_LogList.push_back(SLogEntry(TimeStamp, iSeverity, sMessage)); }
	void AddLogEntry(const std::string& sMessage, unsigned int iSeverity = 5)
		{ AddLogEntry(sMessage, iSeverity, time(0)); }
	t_LogList GetLogEntries(unsigned int iSeverity = 0) const;
	t_LogList GetLogEntries(unsigned int iHighSeverity, unsigned int iLowSeverity) const;
	void WriteToFile(const std::string& sFilename, bool bAppend = true, const std::string& sLogHeader = "") const;
	void Clear(void)
		{ m_LogList.clear(); }

protected:
	t_LogList m_LogList;
};

};


#endif

